{% extends "base.html" %}

{% set current_menu = 'project' %}
{% set current_page = 'project_initiation' %}

{% block title %}项目立项{% endblock %}

{% block content %}
<div class="container mx-auto px-4 py-6">
    <h1 class="text-2xl font-bold mb-6">项目立项</h1>
    
    <!-- 项目立项表单 -->
    <div class="bg-white rounded-lg shadow p-6">
        <h2 class="text-xl font-semibold mb-4">新建项目</h2>
        <form action="/project/initiation/create" method="post">
            <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                <div>
                    <label class="block text-gray-700 text-sm font-bold mb-2" for="name">
                        项目名称 <span class="text-red-500">*</span>
                    </label>
                    <input class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" id="name" name="name" type="text" required>
                </div>
                <div>
                    <label class="block text-gray-700 text-sm font-bold mb-2" for="project_type">
                        项目类型
                    </label>
                    <select class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" id="project_type" name="project_type">
                        <option value="产品研发">产品研发</option>
                        <option value="工程项目">工程项目</option>
                        <option value="咨询服务">咨询服务</option>
                        <option value="系统集成">系统集成</option>
                        <option value="其他">其他</option>
                    </select>
                </div>
                <div>
                    <label class="block text-gray-700 text-sm font-bold mb-2" for="project_source">
                        项目来源
                    </label>
                    <select class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" id="project_source" name="project_source">
                        <option value="公开招标">公开招标</option>
                        <option value="邀请招标">邀请招标</option>
                        <option value="竞争性谈判">竞争性谈判</option>
                        <option value="单一来源">单一来源</option>
                        <option value="内部立项">内部立项</option>
                    </select>
                </div>
                <div>
                    <label class="block text-gray-700 text-sm font-bold mb-2" for="manager_id">
                        项目经理
                    </label>
                    <select class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" id="manager_id" name="manager_id">
                        {% for user in users %}
                        <option value="{{ user.id }}">{{ user.name }}</option>
                        {% endfor %}
                    </select>
                </div>
                <div>
                    <label class="block text-gray-700 text-sm font-bold mb-2" for="customer_id">
                        关联客户
                    </label>
                    <select class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" id="customer_id" name="customer_id">
                        <option value="">无关联客户</option>
                        {% for customer in customers %}
                        <option value="{{ customer.id }}" {% if request.args.get('customer_id') == customer.id|string %}selected{% endif %}>{{ customer.name }}</option>
                        {% endfor %}
                    </select>
                </div>
                <div>
                    <label class="block text-gray-700 text-sm font-bold mb-2" for="budget">
                        项目预算（万元）
                    </label>
                    <input class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" id="budget" name="budget" type="number" step="0.01" min="0">
                </div>
                <div>
                    <label class="block text-gray-700 text-sm font-bold mb-2" for="start_date">
                        开始日期
                    </label>
                    <input class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" id="start_date" name="start_date" type="date">
                </div>
                <div>
                    <label class="block text-gray-700 text-sm font-bold mb-2" for="end_date">
                        结束日期
                    </label>
                    <input class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" id="end_date" name="end_date" type="date">
                </div>
            </div>
            <div class="mt-4">
                <label class="block text-gray-700 text-sm font-bold mb-2" for="description">
                    项目描述
                </label>
                <textarea class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" id="description" name="description" rows="4"></textarea>
            </div>
            <div class="mt-6 flex justify-end">
                <button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline" type="submit">
                    提交立项
                </button>
            </div>
        </form>
    </div>
</div>
{% endblock %}